#!/bin/sh

# configuration
# fichier rrd - path to the rrd file
rrdfile=/usr/local/frogd/data/frogd.rrd

# repertoire ou seront ecrites les images
# path where you want the images to be generated
htmldir=/var/www/html/rrd/graph

rrdpath=""
# programme, ne pas editer apres cette ligne
# don't edit after this line
let nbsecond=3600*$1
$rrdpath/rrdtool graph $htmldir/temp-$1.gif  -s -$nbsecond --title=Temperature \
          DEF:tempe=$rrdfile:temp:AVERAGE -v temperature\
          LINE2:tempe#00a000:"Deg Celsi" \
	  GPRINT:tempe:LAST:"Actuel\: %.1lf -" \
          GPRINT:tempe:MIN:"Mini\: %.1lf -" \
          GPRINT:tempe:MAX:"Maxi\: %.1lf -"\
          GPRINT:tempe:AVERAGE:"Moyen\: %.1lf" 


$rrdpath/rrdtool graph $htmldir/press-$1.gif -s -$nbsecond --alt-autoscale  --title=Pression \
          --units-exponent 0 -v "Pression" \
          DEF:presse=$rrdfile:press:AVERAGE \
          LINE2:presse#0000ff:"hPa moy"  \
          HRULE:1015#0000a0  \
	  GPRINT:presse:LAST:"Actuel\: %.1lf -" \
	  GPRINT:presse:MIN:"Mini\: %.1lf -" \
	  GPRINT:presse:MAX:"Maxi\: %.1lf -" \
	  GPRINT:presse:AVERAGE:"Moyen\: %.1lf" 
          

$rrdpath/rrdtool graph $htmldir/hum-$1.gif --lazy -s -$nbsecond --title=Humidite \
	DEF:hume=$rrdfile:hum:AVERAGE -v humidite \
	LINE2:hume#00a000:"% HR"  \
	COMMENT: \
	GPRINT:hume:LAST:"Actuel\: %.1lf%% -" \
	GPRINT:hume:MIN:"Mini\: %.1lf%% -" \
	GPRINT:hume:MAX:"Maxi\: %.1lf%% -" \
	GPRINT:hume:AVERAGE:"Moyen\: %.1lf %%" 
